package top.wardyan.wdev.dbdevassist.service.impl;

import top.wardyan.wdev.dbdevassist.model.YTDic;
import top.wardyan.wdev.dbdevassist.service.IYTDicService;

public class YTDicServiceImpl extends MasterServiceImpl<YTDic> implements IYTDicService{

	public YTDicServiceImpl(YTDic dao) {
		super(dao);
	}

	@Override
	public java.util.List<YTDic> List() {
		String str = "select a.* , case when ISNULL(a.xItem, '') <> '' then RIGHT(a.xItem, LEN(a.xItem) - 1) else a.xItem end as item " + 
				"from ( " +
				"select m.*, " + 
				"		( " + 
				"		select ';' + cast(n.xValue as varchar(30)) + ':' +  n.xName " + 
				"		from yt_dic_item as n " + 
				"		where n.mID = m.sID " + 
				"		for xml path('') " + 
				"		) as xItem " + 
				"from yt_dic as m " + 
				") as a";
		return this.List(str);
	}

}
